package com.senac.lucas.domain;

// Generated 12/06/2010 01:57:55 by Hibernate Tools 3.2.4.GA

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import org.hibernate.validator.Length;
import org.jboss.seam.annotations.security.management.UserEnabled;
import org.jboss.seam.annotations.security.management.UserPassword;
import org.jboss.seam.annotations.security.management.UserPrincipal;
import org.jboss.seam.annotations.security.management.UserRoles;

/**
 * Usuario
 */
@Entity
@org.hibernate.annotations.Entity(dynamicUpdate = true)
public class Usuario implements java.io.Serializable {

	@Id
	@GeneratedValue
	private Integer id;
	
	@UserPrincipal
	@Column(nullable = false, unique = true, length = 10)
	private String usuario;

	@UserPassword//(hash="MD5")
	@Column(name = "senha", length = 30)
	@Length(max = 30)
	private String senha;
	
	@UserEnabled
	@Column
	private Boolean situacao = Boolean.TRUE;
		
	@UserRoles
	@ManyToMany(targetEntity = Role.class)
	@JoinTable(name = "USUARIO_ROLE", joinColumns = @JoinColumn(name = "USUARIO_ID"), inverseJoinColumns = @JoinColumn(name = "ROLE_ID"))
	private List<Role> roles;

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	
	/**
	 * @return the senha
	 */
	public String getSenha() {
		return senha;
	}

	/**
	 * @param senha the senha to set
	 */
	public void setSenha(String senha) {
		this.senha = senha;
	}

	/**
	 * @return the situacao
	 */
	public Boolean getSituacao() {
		return situacao;
	}

	/**
	 * @param situacao the situacao to set
	 */
	public void setSituacao(Boolean situacao) {
		this.situacao = situacao;
	}

	
	/**
	 * @return the roles
	 */
	public List<Role> getRoles() {
		return roles;
	}

	/**
	 * @param roles the roles to set
	 */
	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}

	/**
	 * @return the usuario
	 */
	public String getUsuario() {
		return usuario;
	}

	/**
	 * @param usuario the usuario to set
	 */
	public void setUsuario(String usuario) {
		this.usuario = usuario;
	}

	
}
